Here’s a direct link to Aaki’s homework 4 repository: https://github.com/ag2965/p8105_hw4_ag2965

Column

Chart A

data("instacart")

instacart = 
  instacart %>% 
  as_tibble(instacart)

instacart%>%
  janitor::clean_names()%>%
plot_ly(
    x = ~product_name, y = ~order_dow, type = "scatter", mode = "markers",
    color = ~order_dow, alpha = 0.5)

data(nyc_airbnb)

nyc_airbnb %>% mutate(text_label = str_c(“Price: $”, price)) %>% #str_c=string combine; =create line break plot_ly( x = ~lat, y = ~long, type = “scatter”, mode = “markers”, color = ~price, text = ~text_label, alpha = 0.5)



Column {data-width=350}
-----------------------------------------------------------------------

### Chart B


```r
nyc_airbnb %>% 
  mutate(neighbourhood = fct_reorder(neighbourhood, price)) %>% 
  plot_ly(y = ~price, color = ~neighbourhood, type = "box", colors = "viridis")

Chart C

nyc_airbnb %>% 
  count(neighbourhood) %>% 
  mutate(neighbourhood = fct_reorder(neighbourhood, n)) %>% 
  plot_ly(x = ~neighbourhood, y = ~n, color = ~neighbourhood, type = "bar", colors = "viridis")